public class Learn9 {
    public static int sum(int n){
        if(n < 10){     // n < 10 就行不用 n / 10 == 0
            return n;
        }
        return n % 10 + sum(n / 10);
    }


    public static void main(String[] args) {
        int ret = sum(123);     //每一位相加
        System.out.println(ret);
    }
}
